home *** CD-ROM | disk | FTP | other *** search
- /*
- * This module handles the selection of a block or underline cursor
- * Author: Jerry LeVan
- * 325 Boone Trail
- * Richmond Ky 40475
- * New File: Sept 27,1987
- *
- */
-
- #include <types.h>
- #include <dialogs.h>
- #include <controls.h>
-
- #define CDialogId 7835
- #define BLOCKITEM 3
- #define UNDERLINEITEM 4
- #define BLINKITEM 5
- #define INVISIBLE 6
-
- #define OK 1
-
- /* the following three variables are found in vt100.c */
- extern Boolean useBlockCursor;
- extern Boolean blink;
- extern Boolean invisible;
-
- #define __SEG__ SetCursorStyle
-
- void SelectCursorStyle()
- {
- DialogPtr theDialog;
- Handle uHandle; /* handle to the underline item */
- Handle bHandle; /* handle to the Block item */
- Handle aHandle; /* handle to the OK button */
- Handle BLHandle; /* handle to blink cursor check box */
- Handle iHandle; /* handle to visible/invisible check box */
- short type; /* return item type */
- Rect box; /* returned enclosing box for item */
- short item; /* returned by modal dialog */
- GrafPtr savePort; /* saved graphport */
-
- GetPort(&savePort); /* just in case...*/
-
- /* get the dialog (created invisible) */
- theDialog = (DialogPtr)GetNewDialog(CDialogId,0,(Ptr)-1);
- SetPort(theDialog);
-
- /* set the controls */
- GetDItem(theDialog,BLOCKITEM,&type,&bHandle,&box);
- GetDItem(theDialog,UNDERLINEITEM,&type,&uHandle,&box);
- GetDItem(theDialog,BLINKITEM,&type,&BLHandle,&box);
- GetDItem(theDialog,INVISIBLE,&type,&iHandle,&box);
- SetCtlValue((ControlHandle)bHandle,useBlockCursor);
- SetCtlValue((ControlHandle)uHandle,!useBlockCursor);
- SetCtlValue((ControlHandle)BLHandle,blink);
- SetCtlValue((ControlHandle)iHandle,!invisible);
-
- /* outline the OK button */
- GetDItem(theDialog,OK,&type,&aHandle,&box);
- PenSize(3,3);
- InsetRect(&box,-4,-4);
- FrameRoundRect(&box,16,16);
- PenSize(1,1);
-
- /* show the window */
- ShowWindow(theDialog);
-
- /* now we can do the dialog */
- do
- { ModalDialog(0,&item);
- if(item == BLOCKITEM){
- useBlockCursor = true;
- SetCtlValue((ControlHandle)bHandle,useBlockCursor);
- SetCtlValue((ControlHandle)uHandle,!useBlockCursor);
- }
- if(item == UNDERLINEITEM){
- useBlockCursor = false;
- SetCtlValue((ControlHandle)bHandle,useBlockCursor);
- SetCtlValue((ControlHandle)uHandle,!useBlockCursor);
- }
- if(item ==BLINKITEM){
- blink = !blink ; /* invert value */
- SetCtlValue((ControlHandle)BLHandle,blink);
- }
- if(item == INVISIBLE){
- invisible = !invisible;
- SetCtlValue((ControlHandle)iHandle,!invisible);
- }
- }
- while (item != OK);
-
- /* cleanup and leave */
- DisposDialog(theDialog);
- SetPort(savePort);
- }
-
-
-